<!DOCTYPE html>
<html lang="en">
<head>
    <title>后台管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" href="../css/login.css">
    <meta charset="UTF-8">
    <script src="../js/ajax.js"></script>
    <script src="../js/jquery-3.1.1.min.js"></script>
</head>
<script>
    $(function () {
        // changeImg();
    });

    function changeImg() {
        //直接跳转到后台代码,和a标签的href一个意思
        document.getElementById("codeimg").src = myCode("code?date=" + Math.random());
    }

    function login() {
        var data = myAjax('login', {username: $("#username").val(), password: $("#password").val()}, "get");
        //json转换[null]
        // data=JSON.parse(data);
        if (data[0] != null) {
            window.open("/back/home.html");
        } else {
            alert("用户名或者密码错误")
        }
    }

    function gofront() {
        window.open("/html/home.html");
    }
</script>
<body>
<div class="login">
    <div class="logintitle">
        <span>后台</span><span>管理</span>
    </div>
    <div class="logincontent">
        <form action="code" method="get">
            <div style="margin-left: 20px;float: left;width: 260px;height: 200px;">
                <div>&nbsp;</div>
                <hr>
                <div class="loginform">
                    <div>
                        <div>登录名</div>
                        <div><input type="text" id="username" name="username" value="aaaaaa"></div>
                    </div>
                    <div>
                        <div>密码</div>
                        <div><input type="password" id="password" name="password" value="111111"></div>
                    </div>
                    <div>
                        <div>验证码</div>
                        <div>
                            <input type="text" class="code" id="code" name="code">
<!--                            <img id="codeimg" src="" alt="验证码" onclick="changeImg()"/>-->
                        </div>
                    </div>
                </div>
                <hr>

            </div>
        </form>
        <div class="sudai"></div>
        <div class="turnziti">WEBMASTER</div>
    </div>
    <div class="loginbutton" onclick="login()">登陆</div>
    <div class="loginbutton" onclick="gofront()">前aa端</div>
</div>
</body>
</html>